package models

import (
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Mobile       string `gorm:"type:char(11);not null;comment:账号"`
	Password     string `gorm:"type:char(32);not null;comment:密码"`
	BusinessTime int    `gorm:"type:datetime;default:time.now();comment:会员持续时间'"`
}

func (u *User) Register() error {
	return DB.Debug().Create(&u).Error
}

func (u *User) ShowUser() error {
	return DB.Debug().Where("mobile = ?", u.Mobile).Find(&u).Error
}
